import { create } from 'zustand'
import { devtools } from 'zustand/middleware'

export const useUserStore = create(devtools(set => ({
  token: localStorage.getItem('token') || null,
  setToken: (token) => {
    if (token) {
      localStorage.setItem('token', token)
    } else {
      localStorage.removeItem('token')
    }
    set({ token })
  },
  // 可扩展更多用户信息
})))
